#include<stdio.h>
#include<stdlib.h>
 
int g_val1 = 100;
int g_val2;

int main(int argc, char* argv[], char* env[])
{
    printf("code adr:%p\n", main);
    printf("init data code:%p\n", &g_val1);
    printf("uninit data code:%p\n", &g_val2);

    char* heap1 = (char*)malloc(10);
    char* heap2 = (char*)malloc(10);
    char* heap3 = (char*)malloc(10);
    char* heap4 = (char*)malloc(10);
    
    printf("stack adr:%p\n", &heap1);
    printf("stack adr:%p\n", &heap2);
    printf("stack adr:%p\n", &heap3);
    printf("stack adr:%p\n", &heap4);

    printf("heap adr:%p\n", heap1);
    printf("heap adr:%p\n", heap2);
    printf("heap adr:%p\n", heap3);
    printf("heap adr:%p\n", heap4);

    for(int i = 0; i < 2; i++)
        printf("命令行参数表%d adr:%p\n", i, argv + i); 

    for(int i = 0; i < 2; i++)
        printf("环境变量表%d adr:%p\n", i, env + i); 

    for(int i = 0; argv[i]; i++)
        printf("argv[%d]=%p\n", i, argv[i]); 

    for(int i = 0; env[i]; i++)
        printf("env[%d]=%p\n", i, env[i]);

    return 0;
}
